package com.xbongbong.saas.service;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.pojo.dto.ValidateDataDTO;
import com.xbongbong.paas.pojo.vo.FormDataAddGetVO;
import com.xbongbong.paas.pojo.vo.FormDataDeleteBatchVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.pro.applist.pojo.vo.ListAppVO;
import com.xbongbong.pro.applist.pojo.vo.MobilePlanStaticVO;
import com.xbongbong.pro.businessdata.pojo.dto.FormatExplainDTO;
import com.xbongbong.pro.businessdata.pojo.dto.HasCommunicatePlanDTO;
import com.xbongbong.pro.communicateplan.pojo.dto.CommunicatePlanDeleteBatchDTO;
import com.xbongbong.pro.communicateplan.pojo.dto.CommunicatePlanUpdateBatchDTO;
import com.xbongbong.pro.communicateplan.pojo.dto.UpdateCommunicatePlanByBusinessRuleDTO;
import com.xbongbong.pro.communicateplan.pojo.vo.CommunicatePlanUpdateBatchVO;
import com.xbongbong.pro.communicateplan.pojo.vo.UpdateCommunicatePlanByBusinessRuleVO;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainBatchLinkItemDTO;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainInLinkItemDTO;
import com.xbongbong.pro.fromdatadictionary.pojo.vo.DictionaryArrayVO;
import com.xbongbong.pro.weblist.pojo.dto.CommunicatePlanDTO;
import com.xbongbong.pro.weblist.pojo.dto.CommunicatePlanOperateDTO;
import com.xbongbong.pro.weblist.pojo.dto.CommunicatePlanSearchDTO;
import com.xbongbong.pro.weblist.pojo.dto.DelayCauseDTO;
import com.xbongbong.pro.weblist.pojo.dto.SaasBaseDTO;
import com.xbongbong.pro.weblist.pojo.vo.CommunicatePlanDayListVO;
import com.xbongbong.pro.weblist.pojo.vo.CommunicatePlanSearchVO;
import com.xbongbong.pro.weblist.pojo.vo.CommunicatePlanStatisicsVO;
import com.xbongbong.pro.weblist.pojo.vo.CustomerPlanVO;
import com.xbongbong.pro.weblist.pojo.vo.SpecialListFilterVO;

import java.util.List;
import java.util.Set;

/**
 * @author long.rao
 * @version v1.0
 * @date 2019/1/22 10:52
 * @since v1.0
 */
public interface CommunicatePlanService {
    /**
     * Description: 访客计划保存前校验
     * @param validateDataDTO saas特殊校验数据入参
     * @throws XbbException 业务异常
     * @author long.rao
     * @date 2019-01-22 10:52
     */
    void beforeSave(ValidateDataDTO validateDataDTO) throws XbbException;

    /**
     * Description: 访客计划保存后逻辑
     * @param saasFormSaveDTO saas保存数据
     * @throws XbbException 业务异常
     * @author long.rao
     * @date 2019-01-22 10:53
     */
    void afterSave(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;



    /**
     * 获取日历有计划的日期
     * @param communicatePlanDTO 参数
     * @return
     * @throws XbbException
     */
    CommunicatePlanDayListVO dayList(CommunicatePlanDTO communicatePlanDTO) throws XbbException;

    /**
     * 访客计划统计
     * @param communicatePlanDTO 参数
     * @return CommunicatePlanStatisicsVO
     * @throws XbbException 业务异常
     */
    CommunicatePlanStatisicsVO statistics(CommunicatePlanDTO communicatePlanDTO) throws XbbException;

    /**
     * 访客计划移动端统计
     * @param communicatePlanDTO 参数
     * @return CommunicatePlanStatisicsVO
     * @throws XbbException 业务异常
     */
    MobilePlanStaticVO mobileStatistics(CommunicatePlanDTO communicatePlanDTO) throws XbbException;

    /**
     * 访客计划列表
     * @param communicatePlanDTO 参数
     * @return CustomerPlanVO
     * @throws XbbException 业务异常
     */
    CustomerPlanVO list(CommunicatePlanDTO communicatePlanDTO) throws XbbException;

    /**
       * @description: 根据客户名称或客户电话进行模糊查询返回客户列表
       * @param communicatePlanSearchDTO
       * @return com.xbongbong.pro.weblist.pojo.vo.CommunicatePlanSearchVO
       * @author zhushuainan
       * @date 2022/03/21 21:01:24
       */
    CommunicatePlanSearchVO getFuzzyQueryList(CommunicatePlanSearchDTO communicatePlanSearchDTO) throws XbbException;

    /**
     * 根据业务规则更新数据
     * @author 吴峰
     * @date 2019/2/17 15:11
     * @param update
     * @return com.xbongbong.pro.communicateplan.pojo.vo.UpdateCommunicatePlanByBusinessRuleVO
     * @throws XbbException 业务异常
     */
    UpdateCommunicatePlanByBusinessRuleVO updateFormDataByBusinessRule(UpdateCommunicatePlanByBusinessRuleDTO update) throws XbbException;

    /**
     * 访客计划状态筛选栏
     * @param saasBaseDTO 参数
     * @return SpecialListFilterVO
     * @throws XbbException 业务异常
     */
    SpecialListFilterVO statusSearch(SaasBaseDTO saasBaseDTO) throws XbbException;

    /**
     *
     * @param communicatePlanOperateDTO 参数
     * @return BaseVO
     * @throws XbbException 业务异常
     */
    BaseVO singleOperate(CommunicatePlanOperateDTO communicatePlanOperateDTO) throws XbbException;

    /**
     * 获取延期原因
     * @param delayCauseDTO
     * @return DictionaryArrayVO
     */
    DictionaryArrayVO getDelayCauseDataDictionary(DelayCauseDTO delayCauseDTO) throws XbbException;
//    CompanyVO statusSearch(SaasBaseDTO saasBaseDTO) throws XbbException;

    FormDataAddGetVO hasPlanFinish(HasCommunicatePlanDTO hasCommunicatePlanDTO) throws XbbException;

    /**
     * 新建时格式化解释
     *
     * @param formatExplainDTO 入参
     * @throws XbbException 异常
     * @author long.rao
     * @date 2019-02-20 18:28
     */
    void formatAddExplain(FormatExplainDTO formatExplainDTO) throws XbbException;

    /**
     * 关联新建时格式化解释
     *
     * @param handlerExplainInLinkItemDTO 入参
     * @throws XbbException 异常
     * @author feng.zheng
     * @date 2019-03-16 20:53
     */
    void formatLinkAddExplain(HandlerExplainInLinkItemDTO handlerExplainInLinkItemDTO) throws XbbException;

    /**
     * 批量关联新建时格式化解释
     *
     * @param handlerExplainBatchLinkItemDTO 入参
     * @throws XbbException 异常
     * @author feng.zheng
     * @date 2019-03-16 20:53
     */
    void formatBatchLinkAddExplain(HandlerExplainBatchLinkItemDTO handlerExplainBatchLinkItemDTO) throws XbbException;

    /**
     * 批量删除
     * @author 吴峰
     * @date 2019/4/10 10:38
     * @param communicatePlanDeleteBatchDTO
     * @return void
     * @throws XbbException 业务异常
     */
    FormDataDeleteBatchVO deleteBatch(CommunicatePlanDeleteBatchDTO communicatePlanDeleteBatchDTO) throws XbbException;

    /**
     * 设置状态筛选
     *
     * @param communicatePlanDTO 入参
     * @return 条件
     * @throws XbbException 异常
     */
    List<ConditionsEntityExt> setConditionList(CommunicatePlanDTO communicatePlanDTO) throws XbbException;

    /**
     * 设置人员筛选
     *
     * @param communicatePlanDTO 入参
     * @param conditionsEntityExtList 条件
     * @return 人员
     * @throws XbbException 异常
     */
    Set<String> setDataCondition(CommunicatePlanDTO communicatePlanDTO, List<ConditionsEntityExt> conditionsEntityExtList) throws XbbException;

    /**
     * 父子文档查询
     * @param communicatePlanDTO
     * @param conditionsEntityExtList
     * @return
     * @throws XbbException
     */
    Set<String> setTeamCondition(CommunicatePlanDTO communicatePlanDTO, List<ConditionsEntityExt> conditionsEntityExtList) throws XbbException;
    /**
     * Description: 客户数据 修改同步访客计划
     * @param corpid
     * @param customerId
     * @param customerName
     * @author 魏荣杰
     * @date 2019/6/11 13:43
     * @since v1.0
     */
    void dataConsistencyUpdateCustomer(String corpid, Long customerId, String customerName) throws XbbException;
    /**
     * Description: 批量更新
     * @param communicatePlanUpdateBatchDTO
     * @author 魏荣杰
     * @date 2019/6/11 15:41
     * @since v1.0
     */
    CommunicatePlanUpdateBatchVO updateBatch(CommunicatePlanUpdateBatchDTO communicatePlanUpdateBatchDTO) throws XbbException;

    /**
     * 封装移动端访客计划数据
     *
     * @param null
     * @throws
     * @author long.rao
     * @date 2019-07-15 15:35
     */
    ListAppVO formatCommunicatePlanAppList(CommunicatePlanDTO communicatePlanDTO, List<PaasFormDataEntityExt> esEntities, Integer totalCount) throws XbbException;

    void afterSaveForWorkflow(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;

    void afterSaveForUpdateWorkflow(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;
    /**
     * 保存执行人到计划协同团队表
     *
     * @param data               数据
     * @param executor           执行人属性
     * @param executorLinkedText 执行人关联属性
     * @param linkCustomerId     关联客户id
     * @param corpid             公司id
     * @param id                 访客计划id
     * @param userId             员工id
     * @author feng.zheng
     * @date 2019/2/14 22:06
     */
    List<String> saveExecutor2CommunicatePlanUser(JSONObject data, String executor, String executorLinkedText, Long linkCustomerId, String corpid, Long id, String userId) throws XbbException;

}
